package com.fish.anne.model;

import com.fish.anne.model.BaseObject;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

import java.io.Serializable;

@Entity
@Table(name="system_role" )
public class SystemRole extends BaseObject implements Serializable {
    private Long roleId;
    private String roleDescription;
    private String roleName;

    @Id   @GeneratedValue(strategy = GenerationType.AUTO)    
    public Long getRoleId() {
        return this.roleId;
    }
    
    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }
    
    @Column(name="role_description", nullable=false)
    public String getRoleDescription() {
        return this.roleDescription;
    }
    
    public void setRoleDescription(String roleDescription) {
        this.roleDescription = roleDescription;
    }
    
    @Column(name="role_name", nullable=false, length=100)
    public String getRoleName() {
        return this.roleName;
    }
    
    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        SystemRole pojo = (SystemRole) o;

        if (roleDescription != null ? !roleDescription.equals(pojo.roleDescription) : pojo.roleDescription != null) return false;
        if (roleName != null ? !roleName.equals(pojo.roleName) : pojo.roleName != null) return false;

        return true;
    }

    public int hashCode() {
        int result = 0;
        result = (roleDescription != null ? roleDescription.hashCode() : 0);
        result = 31 * result + (roleName != null ? roleName.hashCode() : 0);

        return result;
    }

    public String toString() {
        StringBuffer sb = new StringBuffer(getClass().getSimpleName());

        sb.append(" [");
        sb.append("roleId").append("='").append(getRoleId()).append("', ");
        sb.append("roleDescription").append("='").append(getRoleDescription()).append("', ");
        sb.append("roleName").append("='").append(getRoleName()).append("'");
        sb.append("]");
      
        return sb.toString();
    }

}
